package com.snail.monitor;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

public class MonitorRecordFormatter {

    private MonitorRecord record;

    public MonitorRecordFormatter(MonitorRecord record) {
        setRecord(record);
    }

    public String getFormat() {
        List<String> recList = new ArrayList<String>();
        List<OperateRecordInfo> operateRecList = getRecord().getOperateRecList();
        for (int i = 0; i < operateRecList.size(); i++) {
            OperateRecordInfo info = operateRecList.get(i);
            recList.add(info.getFormat());
        }
        return StringUtils.join(recList, "\r\n");
    }

    public MonitorRecord getRecord() {
        return record;
    }

    public void setRecord(MonitorRecord record) {
        this.record = record;
    }
}
